<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/header.jsp"%>
    <div id='container'>
    
     <c:if test="${empty page.records }"> 
      	<h1>您还没有借任何借书记录</h1>
     	<a href="${pageContext.request.contextPath}">去借书</a>
    </c:if>
    <c:if test="${!empty page.records}"> 
   	<h2>您的当前的借书记录如下：</h2>
   	<table border="1" width="738">
   		<tr>
   			<th>借书时间</th>
   			<th>数量</th>
   			<th>书籍单价</th>
   			<th>借书状态</th>
   			<th>操作</th>
   		</tr>
   		<c:forEach items="${page.records}" var="o" varStatus="vs">
   			<tr class="odd">
	   			<td>${o.gentime }</td>
	   			<td>${o.quantity }</td>
	   			<td>${o.price }</td>
	   			<td>
	   				<c:choose>
	   					<c:when test="${o.status==0}">
	   						【借书，管理员处理中...】
	   					</c:when>
	   					<c:when test="${o.status==1}">
	   						【已还】
	   					</c:when>
	   					<c:when test="${o.status==2}">
	   						【借书中...】
	   					</c:when>
	   					<c:when test="${o.status==3}">
	   						【借书，但已拒绝】
	   					</c:when>
	   					<c:when test="${o.status==4}">
	   						【还书，管理员处理中...】
	   					</c:when>
	   				</c:choose>
	   			</td>
	   			<td>
	   				 <c:choose>
						<c:when test="${o.status==0}">
						    请等待...&nbsp;&nbsp;
						   <a href="${pageContext.request.contextPath}/client/CilentServlet?op=showDetails&ordernum=${o.num}">查看明细</a>
						</c:when>
						<c:when test="${o.status==1}">
						    <a href="${pageContext.request.contextPath}">续借其他书</a>&nbsp;&nbsp;
						   <a href="${pageContext.request.contextPath}/client/CilentServlet?op=showDetails&ordernum=${o.num}">查看明细</a>
						</c:when>
						<c:when test="${o.status==2}">
	   					  <a href="javascript:backBook('${o.num }')">去还书</a>&nbsp;&nbsp;
	   					   <a href="${pageContext.request.contextPath}/client/CilentServlet?op=showDetails&ordernum=${o.num}">查看明细</a>
	   					</c:when>
	   					<c:when test="${o.status==3}">
						    <a href="${pageContext.request.contextPath}">续借其他书</a>	&nbsp;&nbsp;					   
						    <a href="${pageContext.request.contextPath}/client/CilentServlet?op=showDetails&ordernum=${o.num}">查看明细</a>
						</c:when>
						<c:when test="${o.status==4}">
						       请等待...&nbsp;&nbsp;
						   <a href="${pageContext.request.contextPath}/client/CilentServlet?op=showDetails&ordernum=${o.num}">查看明细</a>
						</c:when>
					
				   </c:choose>	
	   			    
	   			</td>
	   		</tr>
   		</c:forEach>
   	</table>
   	<%@include file="/commons/page.jsp"%>
   </c:if>
   	</div>
   	<script type="text/javascript">
	function backBook(num) {
		var sure = window.confirm("确认还书？");
		if (sure) {
			window.location.href = "${pageContext.request.contextPath}/client/CilentServlet?op=backBook&num="+ num;
		}
	}
</script>

  </body>
</html>
